#ifndef Asynch_Return_Queue_H
#define Asynch_Return_Queue_H
#include "Task_Base/Task_Base.h"
#include <map>
using namespace std;

class CCriticalSection;
class Srv_Asynch_Man;
class CTcpPackBuf;
class Asynch_Return_Queue:public Task_Base
{
public:
    Asynch_Return_Queue(Srv_Asynch_Man *);
    virtual ~Asynch_Return_Queue(void);
public:
    void atq_add_service_handler(int client_socket);			//当连接到来
    void atq_post_delete_socket(int client_socket);				//关闭连接
    void atq_append_read_buf(int client_socket,const char *pBuf,int nlen);//当数据到来

private:
     virtual int close();
    virtual int svc();//主动工作线程函数
private:
    CTcpPackBuf *  find_socket_read_buf(int client_socket);
    void		   delete_service_handler(int client_socket);     //当连接结束

private:
    Srv_Asynch_Man               *m_pAsynch_man;
    CCriticalSection             *m_poCriSection_read_buf;
    std::map<int,CTcpPackBuf*>	map_socket_read_buf;
};

#endif // Asynch_Return_Queue_H
